package com.lili.collection.core.fields.support;

public class FileRefTypeSupport extends TypeSupport<FileRef> {

    @Override
    public Object create(Object value) {
        return clone(value);
    }

    @Override
    public FileRef convert(Object value) {
        if (value instanceof FileRef) {
            return (FileRef) value;
        }
        throw new TypeSupportConversionException(value.getClass().getSimpleName(), value);
    }

    @Override
    public Object convert(Object value, TypeSupport targetTypeSupport) {
        if (targetTypeSupport instanceof FileRefTypeSupport) {
            return value;
        }
        throw new TypeSupportConversionException(value.getClass().getSimpleName(), value);
    }

    @Override
    public Object clone(Object value) {
        return value;
    }
}
